package com.sita.tingterest.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;

import com.sita.bike.R;
import com.sita.tboard.ActivityBase;
import com.sita.tingterest.fragment.FragmentRecommends;


public class TinterestActivity extends ActivityBase {

    public FragmentRecommends fragmentRecommends;
    public FragmentManager fragmentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ting_activity_main_appbar);
        fragmentManager = getSupportFragmentManager();
        setTabSelection(0);

    }

    private void setTabSelection(int index) {
        FragmentTransaction transaction = fragmentManager.beginTransaction();

        switch (index) {
            case 0:
                if (fragmentRecommends == null) {
                    fragmentRecommends = new FragmentRecommends();
                    transaction.add(android.R.id.tabcontent,
                            fragmentRecommends);

                } else {
                    transaction.show(fragmentRecommends);
                }
                break;

        }
        transaction.commit();

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_user, menu);
        return true;
    }

}
